<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!Doctype html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>添加用户信息</title>
	<%@include file="/common/header.jsp" %>
</head>

<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
	<div class="layui-header">
		<div class="layui-logo">添加用户</div>
		<%@include file="/common/top.jsp" %>
	</div>
	<c:if test="${currentUser.userName ne 'admin'}">
		<%@include file="/common/user_left.jsp" %>
	</c:if>
	<c:if test="${currentUser.userName eq 'admin'}">
		<%@include file="/common/admin_left.jsp" %>
	</c:if>
	<div class="layui-body">
		<div style="margin:15px auto;">
			<form class="layui-form" action="/user/add">
				<<input type="hidden" name="id" value="${user.id}">

				<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
					<div class="layui-input-inline">
						<input type="text" name="userName" value="${user.userName}" required lay-verify="required|username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-form-mid layui-word-aux">2~12个字符，可使用字母、数字、中文，不能全为数字</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">密码</label>
					<div class="layui-input-inline">
						<input type="password" name="password" value="${user.password}" required lay-verify="required|pass" placeholder="请输入密码" autocomplete="off" class="layui-input">
					</div>
					<div class="layui-form-mid layui-word-aux">6~12个字符，可使用字母、数字，区分大小写</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">手机号</label>
					<div class="layui-input-inline">
						<input type="text" name="phone" value="${user.phone}" required lay-verify="required|phone|number" placeholder="请输入手机号" autocomplete="off" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">性别</label>
					<div class="layui-input-block">
						<c:if test="${user.sex eq '男'}">
							<input type="radio" name="sex" value="男" title="男">
							<input type="radio" name="sex" value="女" title="女">
						</c:if>
						<c:if test="${user.sex eq '女'}">
							<input type="radio" name="sex" value="女" title="女">
							<input type="radio" name="sex" value="男" title="男">
						</c:if>
						<c:if test="${user.sex eq null}">
							<input type="radio" name="sex" value="男" title="男">
							<input type="radio" name="sex" value="女" title="女">
						</c:if>
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">专业</label>
					<div class="layui-input-inline">
						<input type="text" name="major"  value="${user.major}" placeholder="请输入专业，可选填" autocomplete="off" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">邮箱</label>
					<div class="layui-input-inline">
						<input type="text" name="email" placeholder="请输入常用邮箱，可选填" autocomplete="off" class="layui-input">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">宿舍区</label>
					<div class="layui-input-inline">
						<select name="dormitory">
							<option value="">请选择所在宿舍区，可选填</option>
							<option value="泰山区">泰山区</option>
							<option value="华山区">华山区</option>
							<option value="启林区">启林区</option>
							<option value="六一区">六一区</option>
							<option value="嵩山区">嵩山区</option>
						</select>
					</div>
				</div>

				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit lay-filter="*">保存</button>
					</div>
				</div>

			</form>
		</div>

	</div>
</div>
<script>
    layui.use(['jquery','layer','form','laydate'], function(){
        var form = layui.form;
        var laydate = layui.laydate;

        //常规用法
        form.on('submit(*)',function(){

        });

        form.render();
    });
</script>

</body>
</html>



<script>
layui.use(['jquery','layer','form'], function(){
	var form = layui.form

    form.on('submit(*)',function(){
        document.getElementById(username).val()
    });


	  form.render();
});
</script>

</body>
</html>